package com.mchsdk.paysdk.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import com.mchsdk.paysdk.activity.ToCertificateActivity;
import com.mchsdk.paysdk.utils.MCHInflaterUtils;
import com.mchsdk.paysdk.utils.ToastUtil;

/**
 * Created by Administrator on 2017/5/3.
 */

public class ToCertificateDialog extends Dialog {

    private View view;
    private Context mContext;
    private Button btn;

    public ToCertificateDialog(@NonNull Context context) {
        super(context);
    }

    public ToCertificateDialog(@NonNull Context context, @StyleRes int themeResId) {
        super(context, themeResId);
        this.mContext = context;
        view = LayoutInflater.from(mContext).inflate(MCHInflaterUtils.getLayout(mContext, "dialog_mch_to_certificate"), null);
    }

    protected ToCertificateDialog(@NonNull Context context, boolean cancelable, @Nullable OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(view);
        btn = (Button) view.findViewById(MCHInflaterUtils.getControl(mContext, "btn_certificate"));
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
                ToastUtil.show(mContext, 11111 + "");
                Intent intent = new Intent(mContext, ToCertificateActivity.class);
//                intent.setAction("ToCertificateActivity.ToCertificate");
                mContext.startActivity(intent);
            }
        });
    }
}
